import requests
import time
import random
from util.headers import get_header

headers = get_header()

for i in range(10):
    fresh_idx = random.randint(0, 100)
    print(f'---------------------{i + 1}--------------------')
    url = f'https://api.bilibili.com/x/web-interface/wbi/index/top/feed/rcmd?web_location=1430650&y_num=5&fresh_type=3&feed_version=V8&fresh_idx_1h={fresh_idx}&fetch_row=1&fresh_idx={fresh_idx}&brush={fresh_idx - 1}&device=win&homepage_ver=1&ps=10&last_y_num=5&screen=1920-342&seo_info=&tt_exp=&&uniq_id=133252744706&w_rid=1f2a475c04fc5f018a212e01730dd615&wts={int(time.time())}'
    response = requests.get(url, headers=headers)
    data = response.json()['data']
    items = data['item']
    for item in items:
        print(item['id'], item['title'])
